home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / doom / quake.zip / HIPGRAPL.ZIP / HIPRUBBL.QC < prev    next >
Text File  |  1997-01-16  |  3KB  |  136 lines

  1. /* Rubble QuickC program 
  2.    By Jim Dose'  9/15/96
  3.    Copyright (c)1996 Hipnotic Interactive, Inc.
  4.    All rights reserved.
  5.    Do not distribute.
  6. */
  7.  
  8. void() hipRubbleTouch =
  9.     {
  10.     if ( self.ltime < self.pausetime )
  11.        return;
  12.        
  13.     if (other.takedamage)
  14.         {
  15.         T_Damage (other, self, self.owner, 10 );
  16.         sound (self, CHAN_WEAPON, "zombie/z_hit.wav", 1, ATTN_NORM);
  17.         self.pausetime = self.ltime + 0.1;
  18.         }
  19.     };
  20.  
  21. void(string rubblename) hipThrowRubble =
  22. {
  23.     local    entity new;
  24.     
  25.     new = spawn();
  26.     new.origin = self.origin;
  27.     setmodel (new, rubblename );
  28.     setsize (new, '0 0 0', '0 0 0');
  29.     new.velocity_x = 70 * crandom();
  30.     new.velocity_y = 70 * crandom();
  31.     new.velocity_z = 140 + 70 * random();
  32.     new.movetype = MOVETYPE_BOUNCE;
  33.     new.solid = SOLID_BBOX;
  34.     new.avelocity_x = random()*600;
  35.     new.avelocity_y = random()*600;
  36.     new.avelocity_z = random()*600;
  37.     new.think = SUB_Remove;
  38.     new.touch = hipRubbleTouch;
  39.     new.ltime = time;
  40.     new.nextthink = time + 13 + random()*10;
  41.     self.pausetime = time;
  42.     new.frame = 0;
  43.     new.flags = 0;
  44. };
  45.  
  46. void() rubble_use =
  47.     {
  48.     local float which;
  49.     local float index;
  50.     
  51.     index = 0;
  52.     
  53.     do 
  54.        {
  55.         which = self.cnt;
  56.         if ( self.cnt == 0 )
  57.             {
  58.             which = 1 + 3*random();
  59.             which = floor( which );
  60.             }
  61.         if ( which == 1 )
  62.            {
  63.            hipThrowRubble( "progs/rubble1.mdl" );
  64.            }
  65.         else if ( which == 2 )
  66.            {
  67.            hipThrowRubble( "progs/rubble3.mdl" );
  68.            }
  69.         else
  70.            {
  71.            hipThrowRubble( "progs/rubble2.mdl" );
  72.            }
  73.         index = index + 1;
  74.         }
  75.     while( index < self.count );
  76.     };
  77.  
  78. /*QUAKED func_rubble (0.4 0.4 0.2) (0 0 0) (32 32 32)
  79.   Spawns random sized rubble when triggered.  
  80.   
  81.   "count" is the number of pieces of rubble to spawn.  Default is 1.
  82. */
  83. void() func_rubble =
  84.     {
  85.     precache_model ("progs/rubble1.mdl");
  86.     precache_model ("progs/rubble2.mdl");
  87.     precache_model ("progs/rubble3.mdl");
  88.     precache_sound ("zombie/z_hit.wav");
  89.     self.classname = "rubble";
  90.     self.cnt = 0;
  91.     self.use = rubble_use;
  92.     };
  93.     
  94. /*QUAKED func_rubble1 (0.4 0.4 0.2) (0 0 0) (8 8 8)
  95.   Spawns small rubble when triggered.  
  96.   
  97.   "count" is the number of pieces of rubble to spawn.  Default is 1.
  98. */
  99. void() func_rubble1 =
  100.     {
  101.     precache_model ("progs/rubble1.mdl");
  102.     precache_sound ("zombie/z_hit.wav");
  103.     self.classname = "rubble1";
  104.     self.cnt = 1;
  105.     self.use = rubble_use;
  106.     };
  107.     
  108. /*QUAKED func_rubble2 (0.4 0.4 0.2) (0 0 0) (16 16 16)
  109.   Spawns medium rubble when triggered.  
  110.   
  111.   "count" is the number of pieces of rubble to spawn.  Default is 1.
  112. */
  113. void() func_rubble2 =
  114.     {
  115.     precache_model ("progs/rubble3.mdl");
  116.     precache_sound ("zombie/z_hit.wav");
  117.     self.classname = "rubble2";
  118.     self.cnt = 2;
  119.     self.use = rubble_use;
  120.     };
  121.     
  122. /*QUAKED func_rubble3 (0.4 0.4 0.2) (0 0 0) (32 32 32)
  123.   Spawns large rubble when triggered.  
  124.   
  125.   "count" is the number of pieces of rubble to spawn.  Default is 1.
  126. */
  127. void() func_rubble3 =
  128.     {
  129.     precache_model ("progs/rubble2.mdl");
  130.     precache_sound ("zombie/z_hit.wav");
  131.     self.classname = "rubble3";
  132.     self.cnt = 3;
  133.     self.use = rubble_use;
  134.     };
  135.     
  136.